# 字典的定义格式

print("定义dict变量:")
my_dict1 = dict()   #空字典
my_dict2 = {10710401:"leo",10710402:"tom",10710403:"alis"} #定义dict变量
print(f"my_dict1的类型为{type(my_dict1)},my_dict1的值为{my_dict1}")
print(f"my_dict2的类型为{type(my_dict2)},my_dict2的值为{my_dict2}")

#获取key值
print("获取key值:")
print(f"10710401的值为：{my_dict2[10710401]}")
print(f"10710402的值为：{my_dict2[10710402]}")
print(f"10710403的值为：{my_dict2[10710403]}")

# 定义嵌套字典
my_dict3 = {
    10710401:["leo","2002","男","99"],
    10710402:["tom","2002","男","89"],
    10710403:["alis","2001","女","90"]
} #定义dict变量
print(f"定义嵌套字典：\n{my_dict3}")

#获取嵌套字典的数据
print(f"10710401的值为：{my_dict3[10710401][2]}")
print(f"10710402的值为：{my_dict3[10710402][2]}")
print(f"10710403的值为：{my_dict3[10710403][2]}")



